cmake_minimum_required(VERSION 3.10)
project(AStarPathfinding)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 17)

# 添加头文件路径
include_directories(include)

# 添加库文件
add_library(Grid src/grid.cpp)
add_library(AStar src/astar.cpp)

# 主程序
add_executable(AStarPathfinding main.cpp)
target_link_libraries(AStarPathfinding Grid AStar)

# 查找系统安装的 Google Test
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

# Google Test 单元测试
enable_testing()
add_executable(AStarTest test/test.cpp)
target_link_libraries(AStarTest ${GTEST_LIBRARIES} pthread Grid AStar)

# 添加测试
add_test(NAME AStarTest COMMAND AStarTest)

# Doxygen 文档生成
find_package(Doxygen)
if(DOXYGEN_FOUND)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif()
